import React, { Component } from 'react'
import NavHeader from '@/components/NavHeader'
import './style.scss'
import Slider from './ui/Slider'
import { getHomeSwiperApi } from '@/api/homeApi'

class Home extends Component {
  state = {
    // 幻灯片数据
    swiperData: [{ id: 0, img: 'http://img.1314000.cn/logo.png', title: '默认' }]
  }

  async componentDidMount() {
    let ret = await getHomeSwiperApi()
    this.state.swiperData = ret.data
    this.setState({})
  }

  render() {
    return (
      <div>
        {/* 导航 */}
        <NavHeader left={false} right={false}>
          菜谱首页
        </NavHeader>
        {/* 幻灯片菜单 */}
        <Slider data={this.state.swiperData} />
      </div>
    )
  }
}

export default Home
